package com.zjitc.backend_shop.security;

import com.zjitc.backend_shop.utils.APIResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/*
    @author： 尤安托
    @date： 2025/4/16 19:02
*/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(value=RuntimeException.class)
    public APIResponse<String> handler(RuntimeException e){
        log.error("运行时异常:-------------->{}"+e.getMessage());
        return new APIResponse<>(2,e.getMessage(),null);
    }
}
